jQuery(document).ready(function() {
	$('#kit-search-more').on('click', function() {
		$('.kit-search-mored').toggle();
	});
	var uid = getQueryVariable('tid');
	var col = [ 
		{
			title:'学员英文名',
			field:'sname',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'ZoomID',
			field:'zoomId',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'教材',
//			field:'state',
			align: 'center',
			valign: 'middle',
			formatter:function(value,row,index){
				var statue="在职";
				if(row.state!=0){
					statue="离职";
				}
				return row.mname+'-'+row.lname;
					
			}
		},
		{
			title:'邮箱',
			field:'email',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'微信',
			field:'wechat',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'电话',
			field:'phone',
			align: 'center',
			valign: 'middle'
		},
//		{
//			title:'加入日期',
//			field:'isDelete',
//			align: 'center',
//			valign: 'middle'
//		},
		{
			title:'等级',
			field:'doneHour',
			align: 'center',
			valign: 'middle'
		},
				{
			title:'籍贯',
			field:'address',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'状态',
			align: 'center',
			valign: 'middle',
			formatter:function(value,row,index){
				var st="未开始";
				if(row.state==1){
					st="进行中";
				}else if(row.state==2){
					st="已完成";
				}
				return st;
					
			}
		},
		{
			title:'负责人',
			field:'uname',
			align: 'center',
			valign: 'middle'
		},
		{
			title:'编辑',
			formatter:function(value,row,index){
				return '<a href="javascript:;" class="layui-btn layui-btn-sm" onclick="detail(\''+row.studentId+'\')">查看详情</a>';
			}
		}
	];

	//------------------------------------------加载列表
	$('#_table').bootstrapTable({
		url:baseUrl+'/teachers/students',
		'method': "GET",
		locale: 'zh-CN',
		detailView: false,
		sidePagination: "server", //服务端处理分页
		striped: true,//隔行变色
		undefinedText: "",
		pagination: true,
		singleSelect: false,
		pageSize: pageList[0],
		cache: false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
		pageNumber: 1,
		pageList: pageList,
		search: false, //不显示 搜索框
		uniqueId: "uniqueid", //每一行的唯一标识，一般为主键列
		showColumns: false, //不显示下拉框（选择显示的列）
		undefinedText: '',
		columns: col,
		queryParams: function(params) {
			return {
				pageNum: this.pageNumber,
				pageSize: this.pageSize,
				sortOrder: params.order,
				teacherId:uid
			}
		},
		
	});

})

var detail= function (studentId){
	parent.layer.open({
		id:studentId+'info',
		maxmin: true,
		type: 2,
		area: modalArea,
		content: './views/form/StudentsDetail.html?studentId='+studentId,
		btn: ['关闭'],
		
		btn2: function(index, layero) {
			console.log(layero);
		}
	});
}
